*Change path here to the folder with code files
cd "C:\Users\ibabenko\ASU Dropbox\Ilona Babenka\_NONPROFIT CEO PAY\RFS_code\RFS_CodeFinal"
*cd "D:\db\Dropbox\IlonaBen\RFS_code\\RFS_CodeFinal"

*install stata packages if not installed already
ssc install estout, replace
ssc install asdoc, replace

*Fig 1. Nonprofit Industries (plotted in Excel)
use ceo_apr22, clear
tab ntee1

/*
A) Art, Culture, and Humanities
B) Education Institutions and Related Activities
C) Environmental Quality Protection and Beautification
D) Animal Related
E) Health General and Rehabilitative
F) Mental Health Crisis Intervention
G) Disease Disorders Medical Disciplines
H) Medical Research
I) Crime Legal Related
J) Employment Job Related
K) Food Agriculture and Nutrition
L) Housing Shelter
M) Public Safety Disaster Preparedness and Relief
N) Recreation Sports Leisure Athletics
O) Youth Development
P) Human Services Multipurpose and other
Q) International Foreign Affairs and National Security
R) Civil Rights Social Action Advocacy
S) Community Improvement Capacity Building
T) Philanthropy Voluntarism and Grant making Foundations
U) Science and Technology Research Institutes Services
V) Social Science Research Institutes
W) Public Society Benefit Multipurpose
X) Religion Related Spiritual Development
Y) Mutual, Membership Benefit Organizations, Other
Z) Internal Use
*/

*Fig 2. CEO Compensation vs. Firm Size
use fig2_apr22, clear
twoway (scatter avg_log_ceo_rev_comm avg_log_rev_comm, msymbol(O)) (scatter avg_log_ceo_rev_char avg_log_rev_char, msymbol(T)) (scatter avg_log_ceo_rev_profit avg_log_rev_profit, msymbol(S)), ytitle(Log(Total Compensation)) xlabel(#5) xtitle(Log(Revenue)) bgcolor(white) graphregion(color(none))
graph export "Output\Fig2.png", as(png) name("Graph") replace

*Fig 3. CEO time series (plotted in Excel)
use ceo_apr22, clear
reghdfe log_tdc1_z ib2014.fyear2##ny, abs(fyear2 ein) cluster(state)

*Fig 4. NonCEO time series  (plotted in Excel)
use nonceo_apr22, clear
reghdfe log_tdc1_w ib2014.fyear2##ny, abs(fyear2 ein) cluster(state)

*T1.A. Summary stats 
use both_apr22, clear

asdoc tabstat j_total_comp_w j_base_comp_w j_bonus_incntv_comp_w j_oth_rptble_comp_w j_def_comp_w j_nontxbl_comp_w ceo hrs_t1 if sample==1, stats(mean sd p10 p50 p90 N) dec(2) label save(Output\T1A.doc) replace

*T1.B. Summary stats 
use ceo_apr22, clear

*number of unique organizations in the main dataset
distinct ein 

asdoc tabstat j_total_comp_w j_base_comp_w j_bonus_incntv_comp_w j_oth_rptble_comp_w j_def_comp_w j_nontxbl_comp_w hrs_t1 if sample==1, stats(mean sd p10 p50 p90 N) dec(2) label save(Output\T1B.doc) replace

*T1.C
use ceo_apr22, clear
asdoc tabstat tot_nonceo assets_scale rev_scale debtat_w bd_ind_w coi whistle audit_cmte family comp_cmte_fill consultant_fill employ_cntrct_fill oth_firms990_fill  compceo_process charity50 femaleceo contri_scale_w employees_scale_w volunteer_scale_w rev_emp_w program_w wage_emp_w if sample==1, stats(mean sd p10 p50 p90 N) dec(2) label save(Output\T1C.doc) replace

*T1.D
use t2_panel, clear
asdoc tabstat j_total_comp_w dlog_tdc1_w log_asset_w log_rev_w debtat_w coi whistle audit_cmte bd_ind_w family, by(ny) columns(stats) dec(3) label save(Output\T1D.doc) replace

reg j_total_comp_w ny, cluster(ein) 
reg dlog_tdc1_w ny, cluster(ein)
reg log_asset_w ny, cluster(ein)
reg log_rev_w ny, cluster(ein)
reg debtat_w ny, cluster(ein)
reg coi ny, cluster(ein)
reg whistle ny, cluster(ein)
reg audit_cmte ny, cluster(ein)
reg bd_ind_w ny, cluster(ein)
reg family ny, cluster(ein)

*T2. Total Pay
use ceo_apr22, clear
set more off
reghdfe log_tdc1_w gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T2.xls, replace tstat bracket excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N) label    
reghdfe log_tdc1_w gov_law10 log_asset_w coi whistle audit_cmte, abs(ein fyear2) cluster(state)
outreg2 using Output\T2.xls, tstat bracket excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N) label
reghdfe log_tdc1_w gov_law10 log_asset_w coi whistle audit_cmte log_rev_w debtat_w bd_ind_w family, abs(ein fyear2) cluster(state)
outreg2 using Output\T2.xls, tstat bracket excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N) label

use both_apr22, clear
set more off
reghdfe log_tdc1_w gov_law_ceo, abs(firm_yr firm_ceo year_ceo) cluster(state)
outreg2 using Output\T2.xls, tstat bracket excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y, CEO-Ind-Year FE, N) label
reghdfe log_tdc1_w gov_law_ceo if (state=="PA" | state=="NJ" | state=="CT" | state=="MA" | state=="VT" | state=="NY"), abs(firm_yr firm_ceo year_ceo) cluster(state)
outreg2 using Output\T2.xls, tstat bracket excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y, CEO-Ind-Year FE, N) label
reghdfe log_tdc1_w gov_law_ceo, abs(firm_yr firm_ceo ceo_yr_ind) cluster(state)
outreg2 using Output\T2.xls, tstat bracket excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, N, CEO-Ind-Year FE, Y) label

*T3.A
use ceo_apr22, clear
set more off
reghdfe log_salary_w gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T3A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)   replace
reghdfe log_bonus_w gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T3A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)   
reghdfe log_perq_w gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T3A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)   
reghdfe log_defer_w gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T3A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)   
reghdfe log_nontax_w gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T3A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)   

*T3.B
use ceo_apr22, clear
set more off
reghdfe bon_dum25k gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T3B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) replace
reghdfe bon_dum50k gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T3B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)   
reghdfe bon_dum75k gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T3B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)   

*T4
use ceo_apr22, clear
set more off
reghdfe avg_hrs_per_wk_c gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T4.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N) replace     
reghdfe avg_hrs_per_wk_c gov_law10 log_asset_w coi whistle audit_cmte, abs(ein fyear2) cluster(state)
outreg2 using Output\T4.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N)
reghdfe avg_hrs_per_wk_c gov_law10 log_asset_w coi whistle audit_cmte log_rev_w debtat_w bd_ind_w family, abs(ein fyear2) cluster(state)
outreg2 using Output\T4.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N)     

use both_apr22, clear
set more off
reghdfe avg_hrs_per_wk_w gov_law_ceo, abs(firm_yr firm_ceo year_ceo) cluster(state)
outreg2 using Output\T4.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y, CEO-Ind-Year FE, N) 
reghdfe avg_hrs_per_wk_w gov_law_ceo if (state=="PA" | state=="NJ" | state=="CT" | state=="MA" | state=="VT" | state=="NY"), abs(firm_yr firm_ceo year_ceo) cluster(state)
outreg2 using Output\T4.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y, CEO-Ind-Year FE, N)
reghdfe avg_hrs_per_wk_w gov_law_ceo, abs(firm_yr firm_ceo ceo_yr_ind) cluster(state)
outreg2 using Output\T4.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, N, CEO-Ind-Year FE, Y)

*T5
use ceo_apr22, clear
set more off
reghdfe log_grnt_contrib_w gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T5.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)  replace
reghdfe log_grnt_contrib_w gov_law10 log_asset_w coi whistle audit_cmte, abs(ein fyear2) cluster(state)
outreg2 using Output\T5.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)  
reghdfe log_grnt_contrib_w gov_law10 if coi_whistle_audit==1, abs(ein fyear2) cluster(state)
outreg2 using Output\T5.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)  
reghdfe log_volunteer2_w gov_law10 , a(ein fyear2) cluster(state)
outreg2 using Output\T5.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)    
reghdfe log_volunteer2_w gov_law10 log_asset_w coi whistle audit_cmte, abs(ein fyear2) cluster(state)
outreg2 using Output\T5.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)    
reghdfe log_volunteer2_w gov_law10 if coi_whistle_audit==1, abs(ein fyear2) cluster(state)
outreg2 using Output\T5.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)    

*T6
use ceo_apr22, clear
set more off
reghdfe log_tdc1_w law_grnt ny_grnt post_grnt log_grnt_contrib_w, abs(year_ny firm_post) cluster(state)
outreg2 using Output\T6.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm-Pre/Post FE, Y, Year-NY FE, Y)    replace
reghdfe log_tdc1_w llaw_grnt lny_grnt lpost_grnt llog_grnt_contrib_w, abs(year_ny firm_post) cluster(state)
outreg2 using Output\T6.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm-Pre/Post FE, Y, Year-NY FE, Y)    
reghdfe log_tdc1_w law_vol ny_vol post_vol log_volunteer2_w, abs(year_ny firm_post) cluster(state)
outreg2 using Output\T6.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm-Pre/Post FE, Y, Year-NY FE, Y)      
reghdfe log_tdc1_w llaw_vol lny_vol lpost_vol llog_volunteer2_w, abs(year_ny firm_post) cluster(state)
outreg2 using Output\T6.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm-Pre/Post FE, Y, Year-NY FE, Y)      

*T7
use ceo_apr22, clear
set more off
reghdfe comp_cmte_fill gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T7.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)   replace
reghdfe consultant_fill gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T7.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)   
reghdfe employ_cntrct_fill gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T7.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)   
reghdfe oth_firms990_fill gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T7.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)   
reghdfe compceo_process gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\T7.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)   

*T8.A
use ceo_apr22, clear
reghdfe log_tdc1_w gov_law10 if charity50==0, abs(ein fyear2) cluster(state)
outreg2 using Output\T8A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N) replace

use both_apr22, clear
reghdfe log_tdc1_w gov_law_ceo if charity50==0, abs(firm_yr firm_ceo fyear2#ceo) cluster(state)
outreg2 using Output\T8A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y)

use ceo_apr22, clear
reghdfe log_tdc1_w gov_law10 if charity50==1, abs(ein fyear2) cluster(state)
outreg2 using Output\T8A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N) 

use both_apr22, clear
reghdfe log_tdc1_w gov_law_ceo if charity50==1, abs(firm_yr firm_ceo fyear2#ceo) cluster(state)
outreg2 using Output\T8A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y)

*T8.B
use female_apr22, clear
reghdfe log_tdc1_w gov_law10  if ceo==1 & female2_2013==0  , a(ein fyear2) cluster(state)
outreg2 using Output\T8B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N) replace
reghdfe log_tdc1_w gov_law_ceo  if female2_2013==0 , a(ein#fyear2 ein#ceo ceo#fyear2) cluster(state)
outreg2 using Output\T8B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y)
reghdfe log_tdc1_w gov_law10  if ceo==1 & female2_2013==1  , a(ein fyear2) cluster(state)
outreg2 using Output\T8B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N) 
reghdfe log_tdc1_w gov_law_ceo  if female2_2013==1 , a(ein#fyear2 ein#ceo ceo#fyear2) cluster(state)
outreg2 using Output\T8B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y)

*T9.A
use ceo_apr22, clear
reghdfe avg_hrs_per_wk_w gov_law10 if charity50==0, abs(ein fyear2) cluster(state)
outreg2 using Output\T9A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) replace
reghdfe log_grnt_contrib_w gov_law10 if charity50==0, abs(ein fyear2) cluster(state)
outreg2 using Output\T9A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) 
reghdfe log_volunteer2_w gov_law10 if charity50==0, abs(ein fyear2) cluster(state)
outreg2 using Output\T9A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) 
reghdfe avg_hrs_per_wk_w gov_law10 if charity50==1, abs(ein fyear2) cluster(state)
outreg2 using Output\T9A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) 
reghdfe log_grnt_contrib_w gov_law10 if charity50==1, abs(ein fyear2) cluster(state)
outreg2 using Output\T9A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) 
reghdfe log_volunteer2_w gov_law10 if charity50==1, abs(ein fyear2) cluster(state)
outreg2 using Output\T9A.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) 

*T9.B
use female_apr22, clear
reghdfe avg_hrs_per_wk_w gov_law10    if ceo==1 & female2_2013==0 , a(ein fyear2) cluster(state)
outreg2 using Output\T9B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) replace
reghdfe log_grnt_contrib_w gov_law10 if ceo==1 & female2_2013==0  , a(ein fyear2) cluster(state)
outreg2 using Output\T9B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)
reghdfe log_volunteer2_w gov_law10  if ceo==1  & female2_2013==0  , a(ein fyear2) cluster(state)
outreg2 using Output\T9B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) 
reghdfe avg_hrs_per_wk_w gov_law10    if ceo==1 & female2_2013==1, a(ein fyear2) cluster(state)
outreg2 using Output\T9B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)
reghdfe log_grnt_contrib_w gov_law10 if ceo==1 & female2_2013==1 , a(ein fyear2) cluster(state)
outreg2 using Output\T9B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)
reghdfe log_volunteer2_w gov_law10  if ceo==1  & female2_2013==1  , a(ein fyear2) cluster(state)
outreg2 using Output\T9B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) 

*T10.A
use t2_panel, replace

asdoc tabstat j_total_comp_w dlog_tdc1_w log_asset_w femaleceo, by(charity50) stats(mean) dec(3) label save(Output\T10A_1.doc) replace
reg j_total_comp_w charity50, cluster(ein)
reg dlog_tdc1_w charity50, cluster(ein)
reg log_asset_w charity50, cluster(ein)
reg femaleceo charity50, cluster(ein)

asdoc tabstat j_total_comp_w dlog_tdc1_w log_asset_w  charity50, by(femaleceo) stats(mean) dec(3) label save(Output\T10A_2.doc) replace
reg j_total_comp_w femaleceo, cluster(ein)
reg dlog_tdc1_w femaleceo, cluster(ein)
reg log_asset_w femaleceo, cluster(ein)
reg charity50 femaleceo, cluster(ein)

*T10.B
use ceo_apr22, clear

reghdfe log_tdc1_w char50contemp, abs(ntee1_r#fyear2) cluster(ein)
outreg2 using Output\T10B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Industry-Year FE, Y) replace
reghdfe log_tdc1_w char50contemp log_asset_w coi whistle audit_cmte, abs(ntee1_r#fyear2) cluster(ein)
outreg2 using Output\T10B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Industry-Year FE, Y)
reghdfe log_tdc1_w char50contemp log_asset_w coi whistle audit_cmte log_rev_w debtat_w bd_ind_w family, abs(ntee1_r#fyear2) cluster(ein)
outreg2 using Output\T10B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Industry-Year FE, Y)
reghdfe log_tdc1_w femaleceo, abs(ntee1_r#fyear2) cluster(ein)
outreg2 using Output\T10B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Industry-Year FE, Y)
reghdfe log_tdc1_w femaleceo log_asset_w coi whistle audit_cmte, abs(ntee1_r#fyear2) cluster(ein)
outreg2 using Output\T10B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Industry-Year FE, Y)
reghdfe log_tdc1_w femaleceo log_asset_w coi whistle audit_cmte log_rev_w debtat_w bd_ind_w family, abs(ntee1_r#fyear2) cluster(ein)
outreg2 using Output\T10B.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Industry-Year FE, Y)

*T11
use amazon_apr22, clear

*number of unique organizations in the dataset
distinct ein

set more off
reghdfe log_tdc1_w gov_law10 if ceo==1, abs(ein fyear2) cluster(state)
outreg2 using Output\T11.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N) replace    
reghdfe log_tdc1_w gov_law10 log_asset_w coi whistle audit_cmte if ceo==1, abs(ein fyear2) cluster(state)
outreg2 using Output\T11.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N)
reghdfe log_tdc1_w gov_law10 log_asset_w coi whistle audit_cmte log_rev_w debt_asset_w bd_ind_w family if ceo==1, abs(ein fyear2) cluster(state)
outreg2 using Output\T11.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N)
reghdfe log_tdc1_w gov_law_ceo, abs(firm_yr firm_ceo year_ceo) cluster(state)
outreg2 using Output\T11.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y, CEO-Ind-Year FE, N)
reghdfe log_tdc1_w gov_law_ceo if (state=="PA" | state=="NJ" | state=="CT" | state=="MA" | state=="VT" | state=="NY") , a(firm_yr firm_ceo year_ceo) cluster(state)
outreg2 using Output\T11.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y, CEO-Ind-Year FE, N)
reghdfe log_tdc1_w gov_law_ceo, abs(firm_yr firm_ceo ceo_yr_ind) cluster(state)
outreg2 using Output\T11.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, N, CEO-Ind-Year FE, Y)

*T12
use amazon_apr22, clear
set more off
reghdfe log_tdc1_w gov_law10 if ceo==1, abs(ein_name_title fyear2) cluster(state)
outreg2 using Output\T12.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, Y, Firm-Person-Title FE, Y) replace     
reghdfe log_tdc1_w gov_law10 log_asset_w coi whistle audit_cmte if ceo==1, abs(ein_name_title fyear2) cluster(state)
outreg2 using Output\T12.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, Y, Firm-Person-Title FE, Y)
reghdfe log_tdc1_w gov_law10 log_asset_w coi whistle audit_cmte log_rev_w debt_asset_w bd_ind_w family if ceo==1, abs(ein_name_title fyear2) cluster(state)
outreg2 using Output\T12.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, Y, Firm-Person-Title FE, Y)
reghdfe turn2 gov_law10 if ceo==1, abs(ein fyear2) cluster(state)
outreg2 using Output\T12.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Person-Title FE, N)
reghdfe turn2 gov_law10 log_asset_w coi whistle audit_cmte if ceo==1, abs(ein fyear2) cluster(state)
outreg2 using Output\T12.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Person-Title FE, N)
reghdfe turn2 gov_law10 log_asset_w coi whistle audit_cmte log_rev_w debt_asset_w bd_ind_w family if ceo==1, abs(ein fyear2) cluster(state)
outreg2 using Output\T12.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Person-Title FE, N)

*C1
use ceo_apr22, clear
* use only qtile columns (3,6,9,12,15,18)
set more off
mmqreg log_tdc1_w gov_law10 if sample==1, abs(ein fyear2) cluster(state_r) q(25)
outreg2 using Output\C1.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) replace     
mmqreg log_tdc1_w gov_law10 log_asset_w coi whistle audit_cmte log_rev_w debtat_w bd_ind_w family if sample==1, abs(ein fyear2) cluster(state_r) q(25)
outreg2 using Output\C1.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)
mmqreg log_tdc1_w gov_law10 if sample==1, abs(ein fyear2) cluster(state_r) q(50)
outreg2 using Output\C1.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)
mmqreg log_tdc1_w gov_law10 log_asset_w coi whistle audit_cmte log_rev_w debtat_w bd_ind_w family if sample==1, abs(ein fyear2) cluster(state_r) q(50)
outreg2 using Output\C1.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)
mmqreg log_tdc1_w gov_law10 if sample==1, abs(ein fyear2) cluster(state_r) q(75)
outreg2 using Output\C1.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)
mmqreg log_tdc1_w gov_law10 log_asset_w coi whistle audit_cmte log_rev_w debtat_w bd_ind_w family if sample==1, abs(ein fyear2) cluster(state_r) q(75)
outreg2 using Output\C1.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)

*C2
use ceo_apr22, clear
set more off
reghdfe log_tdc1_w gov_law10 if coi_whistle_audit==1, abs(ein fyear2) cluster(state)
outreg2 using Output\C2.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N) replace     

use both_apr22, clear
set more off
reghdfe log_tdc1_w gov_law_ceo if coi_whistle_audit==1, abs(firm_yr firm_ceo year_ceo) cluster(state)
outreg2 using Output\C2.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y, CEO-Ind-Year FE, N)

use ceo_apr22, clear
set more off
reghdfe avg_hrs_per_wk_w gov_law10 if coi_whistle_audit==1, abs(ein fyear2) cluster(state)
outreg2 using Output\C2.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N) 

use both_apr22, clear
set more off
reghdfe avg_hrs_per_wk_w gov_law_ceo if coi_whistle_audit==1, abs(firm_yr firm_ceo year_ceo) cluster(state)
outreg2 using Output\C2.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y, CEO-Ind-Year FE, N)

use ceo_apr22, clear
set more off
reghdfe log_tdc1_w gov_law10 if eo38drops==0, abs(ein fyear2) cluster(state)
outreg2 using Output\C2.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N)     

use both_apr22, clear
set more off
reghdfe log_tdc1_w gov_law_ceo if eo38drops==0, abs(firm_yr firm_ceo year_ceo) cluster(state)
outreg2 using Output\C2.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y, CEO-Ind-Year FE, N)

use ceo_apr22, clear
set more off
reghdfe avg_hrs_per_wk_w gov_law10 if eo38drops==0, abs(ein fyear2) cluster(state)
outreg2 using Output\C2.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y, Firm-Year FE, N, Firm-CEO FE, N, CEO-Year FE, N, CEO-Ind-Year FE, N)     

use both_apr22, clear
set more off
reghdfe avg_hrs_per_wk_w gov_law_ceo if eo38drops==0, abs(firm_yr firm_ceo year_ceo) cluster(state)
outreg2 using Output\C2.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, N, Year FE, N, Firm-Year FE, Y, Firm-CEO FE, Y, CEO-Year FE, Y, CEO-Ind-Year FE, N)

*C3
use ceo_apr22, clear
reghdfe rev_emp_w gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\C3.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) replace
reghdfe rev_emp_w gov_law10 log_asset_w coi whistle audit_cmte, abs(ein fyear2) cluster(state)
outreg2 using Output\C3.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)    
reghdfe rev_emp_w gov_law10 if coi_whistle_audit==1, abs(ein fyear2) cluster(state)
outreg2 using Output\C3.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)    
reghdfe program_w gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\C3.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)    
reghdfe program_w gov_law10 log_asset_w coi whistle audit_cmte, abs(ein fyear2) cluster(state)
outreg2 using Output\C3.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)    
reghdfe program_w gov_law10 if coi_whistle_audit==1, abs(ein fyear2) cluster(state)
outreg2 using Output\C3.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)    

*C4
use ceo_apr22, clear
set more off
reghdfe log_wage2_w gov_law10, abs(ein fyear2) cluster(state)
outreg2 using Output\C4.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y) replace
reghdfe log_wage2_w gov_law10 log_asset_w coi whistle audit_cmte, abs(ein fyear2) cluster(state)
outreg2 using Output\C4.xls, tstat bracket label excel bdec(3) tdec(2) drop(i.fyear) nocons addtext(Firm FE, Y, Year FE, Y)    
